package SocialMediaSentiment;

import java.awt.image.BufferedImageFilter;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;

public class CreateNewData {

	public static void main(String[] args) throws IOException {
		
		FileWriter outFile = new FileWriter("mediumnCorrectedTrainSetZero.txt");
		PrintWriter out = new PrintWriter(outFile);
		//createcompareTheShizzle();
		HashMap<Integer, String[]> columnData9 = ReadExcel
				.read("mediumCorrectedTweets.xls", 0, 1);
		//int maxsize = maxSize(columnData9);
		//System.out.println(maxsize);
		Iterator<Integer> k = (Iterator<Integer>) columnData9.keySet()
				.iterator();
		while (k.hasNext()) {
			int key = k.next();
			String[] dataSentiment = columnData9.get(key);
			
			
				StringTokenizer tokenizer = new StringTokenizer(dataSentiment[0],
						" ");
				while (tokenizer.hasMoreTokens()) {
					String word = tokenizer.nextToken();
					out.println(word);
				}
				//out.println("NEXTTWEEEEET");
				//System.out.println("Sentiment: " + sentiment);
			}
		
		out.close();
	}
	
	 private static void createcompareTheShizzle() throws IOException {
		  HashMap<String, Double> shizzle = ReadExcel.compareshizzlefrizzlemizzle("CorrectedCounterTrainSetZero.xls", "CorrectedCounterTrainSetNonZero.xls");
		  Iterator<String> k = (Iterator<String>) shizzle.keySet().iterator();
		   FileWriter fstream = new FileWriter("CorrectedcompareZeroNonZero.txt");
		    BufferedWriter out = new BufferedWriter(fstream);
		   //FileWriter outFile = new FileWriter("comparePositiefNegatief2.txt");
		  //PrintWriter out = new PrintWriter(outFile);
		  while(k.hasNext())
		  {
		   String word = k.next();
		   double value = shizzle.get(word);
		   out.write(word + " " + value);
		   out.newLine();
		   //POSITIEF = nonzero, NEGATIEF = zero
		  }
		  out.close();
		 }
	
	public static int maxSize(HashMap<Integer, HashMap<String, Integer>> data)
	{
		int max = 0;
		Iterator<Integer> k = (Iterator<Integer>) data.keySet()
				.iterator();
		while (k.hasNext()) {
			int key = k.next();
			HashMap<String, Integer> dataSentiment = data.get(key);
			Iterator<String> k2 = (Iterator<String>) dataSentiment.keySet()
					.iterator();
			while (k2.hasNext()) {
				String description = k2.next();
				StringTokenizer tokenizer = new StringTokenizer(description,
						" \t\n\r\f,.:;/&$%()+*");
				int amount = tokenizer.countTokens();
				if(amount > max)
				{
					max = amount;
					while (tokenizer.hasMoreTokens()) {
						String word = tokenizer.nextToken();
						if (word != word.toUpperCase())
							word = word.toLowerCase();
						System.out.print(word + " ");
					}
					System.out.println( "   SIZE = " + max);
				}
			}
		}
		return max;
	}
}
